package com.zdpx.pxframework.system.controller;

import com.zdpx.pxframework.core.vo.Result;
import com.zdpx.pxframework.system.api.RoleDepartmentDataScopeControllerApi;
import com.zdpx.pxframework.system.service.RoleDepartmentDataScopeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * 角色部门数据权限 接口控制器
 *
 * @Description:
 * @Author: Cheng Xiaoxiao
 * @Date: 2022-05-26 16:43:27
 */
@RestController
@RequestMapping("/role-department-data-scope")
public class RoleDepartmentDataScopeController implements RoleDepartmentDataScopeControllerApi {
    @Resource
    private RoleDepartmentDataScopeService roleDepartmentDataScopeService;


    /**
     * 根据角色ID列表查询所关联的部门ID列表
     *
     * @param roleIds 角色ID
     * @return 结果信息
     */
    @Override
    @GetMapping("/department")
    public Result<List<String>> listDeptsByRoleIds(@RequestParam("roleIds") List<String> roleIds) {
        return Result.success(roleDepartmentDataScopeService.listDepartmentsByRoleIds(roleIds));
    }
}
